package vip.liux.contracts.shared.enums;

import vip.liux.core.enums.IEnum;

public enum ErrorCode implements IEnum {
    // ========== 全局错误码 1-000-000-000 ==========
    SUCCESS(200, "成功"),
    BAD_REQUEST(400, "请求参数有误"),
    UNAUTHORIZED(401, "服务器内部错误"),
    FORBIDDEN(403, "服务器内部错误"),
    NOT_FOUND(404, "服务器内部错误"),
    METHOD_NOT_ALLOWED(405, "服务器内部错误"),
    LOCKED(423, "服务器内部错误"),
    TOO_MANY_REQUESTS(429, "服务器内部错误"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    NOT_IMPLEMENTED(501, "服务器内部错误"),
    ERROR_CONFIGURATION(502, "服务器内部错误"),
    REPEATED_REQUESTS(900, "服务器内部错误"),
    DEMO_DENY(901, "服务器内部错误"),
    UNKNOWN(999, "服务器内部错误"),


    // ========== APP 模块 1-007-000-000 ==========
    APP_NOT_FOUND(1_007_000_000, "App 不存在"),
    APP_IS_DISABLE(1_007_000_002, "App 已经被禁用"),
    APP_EXIST_ORDER_CANT_DELETE(1_007_000_003, "支付应用存在支付订单，无法删除"),
    APP_EXIST_REFUND_CANT_DELETE(1_007_000_004, "支付应用存在退款订单，无法删除"),
    APP_KEY_EXISTS(1_007_000_005, "支付应用标识已经存在"),


    // ========== CHANNEL 模块 1-007-001-000 ==========
    CHANNEL_NOT_FOUND(1_007_001_000, "支付渠道的配置不存在"),
    CHANNEL_IS_DISABLE(1_007_001_001, "支付渠道已经禁用"),
    CHANNEL_EXIST_SAME_CHANNEL_ERROR(1_007_001_004, "已存在相同的渠道"),

    // ========== ORDER 模块 1-007-002-000 ==========
    PAY_ORDER_NOT_FOUND(1_007_002_000, "支付订单不存在"),
    PAY_ORDER_STATUS_IS_NOT_WAITING(1_007_002_001, "支付订单不处于待支付"),
    PAY_ORDER_STATUS_IS_SUCCESS(1_007_002_002, "订单已支付，请刷新页面"),
    PAY_ORDER_IS_EXPIRED(1_007_002_003, "支付订单已经过期"),
    PAY_ORDER_SUBMIT_CHANNEL_ERROR(1_007_002_004, "发起支付报错，错误码：{}，错误提示：{}"),
    PAY_ORDER_REFUND_FAIL_STATUS_ERROR(1_007_002_005, "支付订单退款失败，原因：状态不是已支付或已退款"),

    // ========== ORDER 模块(拓展单) 1-007-003-000 ==========
    PAY_ORDER_EXTENSION_NOT_FOUND(1_007_003_000, "支付交易拓展单不存在"),
    PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING(1_007_003_001, "支付交易拓展单不处于待支付"),
    PAY_ORDER_EXTENSION_IS_PAID(1_007_003_002, "订单已支付，请等待支付结果"),

    // ========== 支付模块(退款) 1-007-006-000 ==========
    REFUND_PRICE_EXCEED(1_007_006_000, "退款金额超过订单可退款金额"),
    REFUND_HAS_REFUNDING(1_007_006_002, "已经有退款在处理中"),
    REFUND_EXISTS(1_007_006_003, "已经存在退款单"),
    REFUND_NOT_FOUND(1_007_006_004, "支付退款单不存在"),
    REFUND_STATUS_IS_NOT_WAITING(1_007_006_005, "支付退款单不处于待退款"),

    // ========== 钱包模块 1-007-007-000 ==========
    WALLET_NOT_FOUND(1_007_007_000, "用户钱包不存在"),
    WALLET_BALANCE_NOT_ENOUGH(1_007_007_001, "钱包余额不足"),
    WALLET_TRANSACTION_NOT_FOUND(1_007_007_002, "未找到对应的钱包交易"),
    WALLET_REFUND_EXIST(1_007_007_003, "已经存在钱包退款"),
    WALLET_FREEZE_PRICE_NOT_ENOUGH(1_007_007_004, "钱包冻结余额不足"),

    // ========== 钱包充值模块 1-007-008-000 ==========
    WALLET_RECHARGE_NOT_FOUND(1_007_008_000, "钱包充值记录不存在"),
    WALLET_RECHARGE_UPDATE_PAID_STATUS_NOT_UNPAID(1_007_008_001, "钱包充值更新支付状态失败，钱包充值记录不是【未支付】状态"),
    WALLET_RECHARGE_UPDATE_PAID_PAY_ORDER_ID_ERROR(1_007_008_002, "钱包充值更新支付状态失败，支付单编号不匹配"),
    WALLET_RECHARGE_UPDATE_PAID_PAY_ORDER_STATUS_NOT_SUCCESS(1_007_008_003, "钱包充值更新支付状态失败，支付单状态不是【支付成功】状态"),
    WALLET_RECHARGE_UPDATE_PAID_PAY_PRICE_NOT_MATCH(1_007_008_004, "钱包充值更新支付状态失败，支付单金额不匹配"),
    WALLET_RECHARGE_REFUND_FAIL_NOT_PAID(1_007_008_005, "钱包发起退款失败，钱包充值订单未支付"),
    WALLET_RECHARGE_REFUND_FAIL_REFUNDED(1_007_008_006, "钱包发起退款失败，钱包充值订单已退款"),
    WALLET_RECHARGE_REFUND_BALANCE_NOT_ENOUGH(1_007_008_007, "钱包发起退款失败，钱包余额不足"),
    WALLET_RECHARGE_REFUND_FAIL_REFUND_ORDER_ID_ERROR(1_007_008_008, "钱包退款更新失败，钱包退款单编号不匹配"),
    WALLET_RECHARGE_REFUND_FAIL_REFUND_NOT_FOUND(1_007_008_009, "钱包退款更新失败，退款订单不存在"),
    WALLET_RECHARGE_REFUND_FAIL_REFUND_PRICE_NOT_MATCH(1_007_008_010, "钱包退款更新失败，退款单金额不匹配"),
    WALLET_RECHARGE_PACKAGE_NOT_FOUND(1_007_008_011, "钱包充值套餐不存在"),
    WALLET_RECHARGE_PACKAGE_IS_DISABLE(1_007_008_012, "钱包充值套餐已禁用"),
    WALLET_RECHARGE_PACKAGE_NAME_EXISTS(1_007_008_013, "钱包充值套餐名称已存在"),

    // ========== 转账模块 1-007-009-000 ==========
    PAY_TRANSFER_NOT_FOUND(1_007_009_001, "转账单不存在"),
    PAY_TRANSFER_CREATE_CHANNEL_NOT_MATCH(1_007_009_002, "转账发起失败，原因：两次相同转账请求的类型不匹配"),
    PAY_TRANSFER_CREATE_PRICE_NOT_MATCH(1_007_009_003, "转账发起失败，原因：两次相同转账请求的金额不匹配"),
    PAY_TRANSFER_CREATE_FAIL_STATUS_NOT_CLOSED(1_007_009_004, "转账发起失败，原因：已经存在相同的转账单，且状态不是已关闭"),
    PAY_TRANSFER_NOTIFY_FAIL_STATUS_IS_NOT_WAITING(1_007_009_006, "通知转账结果失败，原因：转账单不处于待转账"),
    PAY_TRANSFER_NOTIFY_FAIL_STATUS_NOT_WAITING_OR_PROCESSING(1_007_009_007, "通知转账结果失败，原因：转账单不处于待转账或转账中"),

    // ========== 示例订单 1-007-900-000 ==========
    DEMO_ORDER_NOT_FOUND(1_007_900_000, "示例订单不存在"),
    DEMO_ORDER_UPDATE_PAID_STATUS_NOT_UNPAID(1_007_900_001, "示例订单更新支付状态失败，订单不是【未支付】状态"),
    DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR(1_007_900_002, "示例订单更新支付状态失败，支付单编号不匹配"),
    DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS(1_007_900_003, "示例订单更新支付状态失败，支付单状态不是【支付成功】状态"),
    DEMO_ORDER_UPDATE_PAID_FAIL_PAY_PRICE_NOT_MATCH(1_007_900_004, "示例订单更新支付状态失败，支付单金额不匹配"),
    DEMO_ORDER_REFUND_FAIL_NOT_PAID(1_007_900_005, "发起退款失败，示例订单未支付"),
    DEMO_ORDER_REFUND_FAIL_REFUNDED(1_007_900_006, "发起退款失败，示例订单已退款"),
    DEMO_ORDER_REFUND_FAIL_REFUND_NOT_FOUND(1_007_900_007, "发起退款失败，退款订单不存在"),
    DEMO_ORDER_REFUND_FAIL_REFUND_NOT_SUCCESS(1_007_900_008, "发起退款失败，退款订单未退款成功"),
    DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR(1_007_900_009, "发起退款失败，退款单编号不匹配"),
    DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH(1_007_900_010, "发起退款失败，退款单金额不匹配"),

    // ========== 示例提现单 1-007-901-000 ==========
    DEMO_WITHDRAW_NOT_FOUND(1_007_901_000, "示例提现单不存在"),
    DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_TRANSFER_ID_ERROR(1_007_901_001, "更新示例提现单状态失败，支付转账单编号不匹配"),
    DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_TRANSFER_STATUS_NOT_SUCCESS_OR_CLOSED(1_007_901_002, "更新示例提现单状态失败，支付转账单状态不是【转账成功】或【转账失败】状态"),
    DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_PRICE_NOT_MATCH(1_007_901_003, "更新示例提现单状态失败，支付转账单金额不匹配"),
    DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_MERCHANT_EXISTS(1_007_901_004, "更新示例提现单状态失败，支付转账单商户订单号不匹配"),
    DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_CHANNEL_NOT_MATCH(1_007_901_005, "更新示例提现单状态失败，支付转账单渠道不匹配"),
    DEMO_WITHDRAW_TRANSFER_FAIL_STATUS_NOT_WAITING_OR_CLOSED(1_007_901_008, "发起转账失败，原因：示例提现单状态不是【等待提现】或【提现关闭】"),

    ;
    final int value;

    final String desc;

    ErrorCode(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public int getValue() {
        return value;
    }

    @Override
    public String getDesc() {
        return desc;
    }
}
